package com.fishingwithme.infrastructure.dtos;

import com.fishingwithme.domain.common.Location;
import cn.fishingwithme.domain.spots.*;
import com.fishingwithme.domain.spots.*;
import com.fishingwithme.infrastructure.utils.CommonUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
public class SpotDetailDto {
    private Long id;
    private String name;

    @JsonIgnore
    private double longitude;
    @JsonIgnore
    private double latitude;

    private Boolean isFree;

    private List<String> pics;

    private List<ObjectNode> spotTypes;
    private List<ObjectNode> fishTypes;
    private Location location;

    /**
     * 钓点类型
     */
    @JsonIgnore
    private String sTypes;

    /**
     * 钓点鱼种
     */
    @JsonIgnore
    private String fTypes;

    @JsonIgnore
    private String pictures;

    private Boolean parkingEasy;

    private SpotLvl lvl;

    private ParkingDistance distance;

    private Boolean secret;


    private WaterType waterType;

    private String description;

    private Date updatedAt;

    private Long createdBy;
    private String createdByName;
    private Integer creditVal;
    private Boolean disabled;

    public SpotDetailDto format() {
        this.setLocation(new Location(this.getLatitude(), this.getLongitude()));
        this.setPics(CommonUtils.convert(this.getPictures(), String.class));
        this.setSpotTypes(CommonUtils.convert(this.getSTypes(), SpotType.class));
        this.setFishTypes(CommonUtils.convert(this.getFTypes(), FishType.class));
        return this;

    }
}

